package org.example.util;

import java.util.*;

/**
 * @author linjinde
 */
public class MyProperties extends Properties {
    private final LinkedHashSet<Object> keys = new LinkedHashSet();

    public Enumeration<Object> keys() {
        return Collections.enumeration(this.keys);
    }


    public Object put(Object key, Object value) {
        this.keys.add(key);
        return super.put(key, value);
    }

    public Set<Object> keySet() {
        return this.keys;
    }


    public Set<String> stringPropertyNames() {
        Set<String> set = new LinkedHashSet<>();

        for (Object key : this.keys) {
            set.add((String) key);
        }

        return set;
    }
}
